#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define XH(i,a,b) for(int i = a; i < b; ++i)
#define XXH(i,b,a) for(int i = b; i >= a; --i)
#define Module 998244353
int tInt;ll tll;string tString;char tChar;
vector<int>tIVector;

int a,b;

void solve(){
  int i = b;
  for(;i>=1;--i){
    int x = a/i;
    if(a%i != 0) ++x;
    int y = b/i;
    if(y > x && x * i >= a && y * i <= b){
      printf("%d\n",i);
      return;
    }
  }
}

int main(){
  #ifndef ONLINE_JUDGE
    auto start_clock = clock();
    //freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
  #endif
  cin>>a>>b;
  solve();
  
  #ifndef ONLINE_JUDGE
    auto end_clock = clock();
    //cout<<"runtime: "<<end_clock - start_clock<<"ms"<<endl;
  #endif
  return 0;
}
